package b.i.b;

import android.app.AppOpsManager;
import android.app.NotificationManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build.VERSION;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;

/* compiled from: NotificationManagerCompat */
public final class j {
    public final Context a;
    public final NotificationManager b;

    static {
        HashSet hashSet = new HashSet();
    }

    public j(Context context) {
        this.a = context;
        this.b = (NotificationManager) context.getSystemService("notification");
    }

    public boolean a() {
        if (VERSION.SDK_INT >= 24) {
            return this.b.areNotificationsEnabled();
        }
        AppOpsManager appOpsManager = (AppOpsManager) this.a.getSystemService("appops");
        ApplicationInfo applicationInfo = this.a.getApplicationInfo();
        String packageName = this.a.getApplicationContext().getPackageName();
        int i = applicationInfo.uid;
        boolean z = true;
        try {
            Class cls = Class.forName(AppOpsManager.class.getName());
            r7 = new Class[3];
            Class cls2 = Integer.TYPE;
            r7[0] = cls2;
            r7[1] = cls2;
            r7[2] = String.class;
            if (((Integer) cls.getMethod("checkOpNoThrow", r7).invoke(appOpsManager, new Object[]{Integer.valueOf(((Integer) cls.getDeclaredField("OP_POST_NOTIFICATION").get(Integer.class)).intValue()), Integer.valueOf(i), packageName})).intValue() != 0) {
                z = false;
            }
        } catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException | NoSuchMethodException | RuntimeException | InvocationTargetException unused) {
        }
        return z;
    }
}
